package tools.Project3.Group3.s12cs342;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.StringTokenizer;

import android.content.ContentValues;
import android.database.sqlite.SQLiteDatabase;


public class DownloadQuizzes {

	String inputLine;
	public DownloadQuizzes(){
		
	}
	
	public String [] importQuizzes(String urlString){
		BufferedInputStream input = null;
		BufferedOutputStream output = null;
		URL url = null;
		BufferedWriter writer = null;

		try {
			url = new URL(urlString);
			input = new BufferedInputStream((url.openStream()));

			BufferedReader br = new BufferedReader(new InputStreamReader(
					url.openStream()));
			String [] quizArray = new String [10];
			int count = 0;
			while(!(inputLine = br.readLine()).equals(null)){
				quizArray[count] = inputLine;
				count++;
			}
			br.close();

		} catch (MalformedURLException e) { // System.out.println("URL incorrectly formed");}

		} catch (IOException e) {
			System.out.println(e.getMessage());
		} finally {
			if (writer != null) {
				try {
					writer.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			try {
				if (input != null)
					input.close();
				if (output != null)
					output.close();
			} catch (IOException e) {
			}
		}
		return null;
	}
}
